/*****************************************************************
**                                                             	**
**  Copyright (C) 2004 Amlogic,Inc.                            	**
**  All rights reserved                                        	**
**        Filename : ir.c /Project:AVOS demo 				       **
**        Revision : 1.1                                       	**
**                                                             	**
*****************************************************************/

#include "aw_windows.h"
#include "aw_sys_app.h"
#include "aw_gui_app.h"
#include "LogoEvent.h"
#include "../user.h"
#include "Chipsupport.h"
#include "ctrlconvert.h"
#include "NetmenuSetupEvent.h"
#include "volatile_read.h" 

extern INT8U PlayBackHome;
typedef struct {
       unsigned char IrKey;
       unsigned char IrFlag;
} INPUTKETMAP;

#ifdef SUPPORT_STANDBY
#define WRITE_MPEG_REG_ISA(reg, val) *(volatile unsigned *) (reg) = (val)
#define READ_MPEG_REG_ISA(reg)           (READ_VOLATILE_UINT32(reg)) 
#define	VENC_VDAC_SETTING			0x1102df8
#define PERI_BASE_ADDR               0x01200000
#define READ_PERI_REG(reg) (READ_VOLATILE_UINT32(PERI_BASE_ADDR + (reg)))

#endif


#ifdef WANLIDA_REMOTE
#define CUSTOM_CODE	0x2035
const INPUTKETMAP NecIrKey[]={
/*0x00*/   {UOP_1,0},
/*0x01*/   {UOP_2,0},
/*0x02*/   {UOP_3,0},
/*0x03*/   {UOP_4,0},
/*0x04*/   {UOP_5,0},
/*0x05*/   {UOP_SLIDE_SHOW,0},  //UOP_6
/*0x06*/   {UOP_MUSIC,0},       //UOP_7
/*0x07*/   {UOP_8,0},
/*0x08*/   {UOP_MOVIE,0},       //UOP_9
/*0x09*/   {UOP_CLEAR,0},
/*0x0A*/   {UOP_ZOOM,0},
/*0x0B*/   {UOP_PHOTO,0},       //UOP_0
/*0x0C*/   {UOP_POWER,0},
/*0x0D*/   {UOP_OPEN_CLOSE,0},
/*0x0E*/   {UOP_ENTER,0},
/*0x0F*/   {UOP_NOP,0},
/*0x10*/   {UOP_UP,0},
/*0x11*/   {UOP_DOWN,0},
/*0x12*/   {UOP_LEFT,0},
/*0x13*/   {UOP_RIGHT,0},
/*0x14*/   {UOP_NOP,0},
/*0x15*/   {UOP_TITLE,0},
/*0x16*/   {UOP_MENU,0},
/*0x17*/   {UOP_PBC,0},
/*0x18*/   {UOP_TIME_PLAY,0},
/*0x19*/   {UOP_MUTE,0},
/*0x1A*/   {UOP_VOL_MINUS,0},   //UOP_PAUSE
/*0x1B*/   {UOP_VOL_PLUS,0},    //UOP_SHUFFLE
/*0x1C*/   {UOP_NOP,0},
/*0x1D*/   {UOP_PROGRAM,0},
/*0x1E*/   {UOP_SUBPICTURE,0},
/*0x1F*/   {UOP_AUDIO,0},
/*0x20*/   {UOP_AUDIO,0},
/*0x21*/   {UOP_OSD,0},
/*0x22*/   {UOP_DOWN,0},
/*0x23*/   {UOP_END_PAUSE,0},
/*0x24*/   {UOP_STOP,0},
/*0x25*/   {UOP_NOP,0},
/*0x26*/   {UOP_NOP,0},
/*0x27*/   {UOP_NOP,0},
/*0x28*/   {UOP_NOP,0},
/*0x29*/   {UOP_NOP,0},
/*0x2A*/   {UOP_NOP,0},
/*0x2B*/   {UOP_NOP,0},
/*0x2C*/   {UOP_NOP,0},
/*0x2D*/   {UOP_NOP,0},
/*0x2E*/   {UOP_NOP,0},
/*0x2F*/   {UOP_NOP,0},
/*0x30*/   {UOP_RESUME,0},
/*0x31*/   {UOP_SETUP,1},
/*0x32*/   {UOP_NOP, 0},
/*0x33*/   {UOP_NOP,0},
/*0x34*/   {UOP_NOP,0},
/*0x35*/   {UOP_UP,0},
/*0x36*/   {UOP_NOP,0},
/*0x37*/   {UOP_NOP,0},
/*0x38*/   {UOP_LEFT,0},
/*0x39*/   {UOP_ENTER,0},
/*0x3A*/   {UOP_RIGHT,0},
/*0x3B*/   {UOP_NOP,0},
/*0x3C*/   {UOP_NOP,0},
/*0x3D*/   {UOP_NOP,0},
/*0x3E*/   {UOP_NOP,0},
/*0x3F*/   {UOP_NOP,0},
/*0x40*/   {UOP_FAST_BACKWARD,0},
/*0x41*/   {UOP_FAST_FORWARD,0},
/*0x42*/   {UOP_PREVIOUS_CHAP,0},
/*0x43*/   {UOP_NEXT_CHAP,0},
/*0x44*/   {UOP_END_PAUSE,0},
/*0x45*/   {UOP_STOP,0},
/*0x46*/   {UOP_NOP,0},
/*0x47*/   {UOP_NOP,0},
/*0x48*/   {UOP_REPEAT,0},
/*0x49*/   {UOP_TIME_CHANGE2,0},
/*0x4A*/   {UOP_RESUME,0},
/*0x4B*/   {UOP_OSD,0},
/*0x4C*/   {UOP_NTSC_PAL,0},
/*0x4D*/   {UOP_HD,0},
/*0x4E*/   {UOP_VGA,0},
/*0x4F*/   {UOP_NOP,0},
/*0x50*/   {UOP_NOP,0},
/*0x51*/   {UOP_NOP,0},
/*0x52*/   {UOP_NOP,0},
/*0x53*/   {UOP_NOP,0},
/*0x54*/   {UOP_NOP,0},
/*0x55*/   {UOP_NOP,0},
/*0x56*/   {UOP_NOP,0},
/*0x57*/   {UOP_NOP,0},
/*0x58*/   {UOP_NOP,0},
/*0x59*/   {UOP_NOP,0},
/*0x5A*/   {UOP_NOP,0},
/*0x5B*/   {UOP_NOP,0},
/*0x5C*/   {UOP_FAST_FORWARD,0},
/*0x5D*/   {UOP_NOP,0},
/*0x5E*/   {UOP_NOP,0},
/*0x5F*/   {UOP_NOP,0},
/*0x60*/   {UOP_NOP,0},
/*0x61*/   {UOP_TITLE,0},
/*0x62*/   {UOP_PREVIOUS_CHAP,0},
/*0x63*/   {UOP_NOP,0},
/*0x64*/   {UOP_NOP,0},
/*0x65*/   {UOP_NOP,0},
/*0x66*/   {UOP_NEXT_CHAP,0},
/*0x67*/   {UOP_NOP,0},
/*0x68*/   {UOP_NOP,0},
/*0x69*/   {UOP_NOP,0},
/*0x6A*/   {UOP_FAST_BACKWARD,0},
/*0x6B*/   {UOP_NOP,0},
/*0x6C*/   {UOP_NOP,0},
/*0x6D*/   {UOP_NOP,0},
/*0x6E*/   {UOP_NOP,0},
/*0x6F*/   {UOP_NOP,0},
/*0x70*/   {UOP_NOP,0},
/*0x71*/   {UOP_NOP,0},
/*0x72*/   {UOP_NOP,0},
/*0x73*/   {UOP_NOP,0},
/*0x74*/   {UOP_NOP,0},
/*0x75*/   {UOP_NOP,0},
/*0x76*/   {UOP_NOP,0},
/*0x77*/   {UOP_NOP,0},
/*0x78*/   {UOP_NOP,0},
/*0x79*/   {UOP_NOP,0},
/*0x7A*/   {UOP_NOP,0},
/*0x7B*/   {UOP_NOP,0},
/*0x7C*/   {UOP_NOP,0},
/*0x7D*/   {UOP_NOP,0},
/*0x7E*/   {UOP_NOP,0},
/*0x7F*/   {UOP_NOP,0},
/*0x80*/   {UOP_NOP,0},
/*0x81*/   {UOP_NOP,0},
/*0x82*/   {UOP_NOP,0},
/*0x83*/   {UOP_NOP,0},
/*0x84*/   {UOP_NOP,0},
/*0x85*/   {UOP_NOP,0},
/*0x86*/   {UOP_NOP,0},
/*0x87*/   {UOP_NOP,0},
/*0x88*/   {UOP_NOP,0},
/*0x89*/   {UOP_NOP,0},
/*0x8A*/   {UOP_NOP,0},
/*0x8B*/   {UOP_NOP,0},
/*0x8C*/   {UOP_NOP,0},
/*0x8D*/   {UOP_NOP,0},
/*0x8E*/   {UOP_NOP,0},
/*0x8F*/   {UOP_NOP,0},
/*0x90*/   {UOP_NOP,0},
/*0x91*/   {UOP_NOP,0},
/*0x92*/   {UOP_NOP,0},
/*0x93*/   {UOP_NOP,0},
/*0x94*/   {UOP_NOP,0},
/*0x95*/   {UOP_NOP,0},
/*0x96*/   {UOP_NOP,0},
/*0x97*/   {UOP_NOP,0},
/*0x98*/   {UOP_NOP,0},
/*0x99*/   {UOP_NOP,0},
/*0x9A*/   {UOP_NOP,0},
/*0x9B*/   {UOP_NOP,0},
/*0x9C*/   {UOP_NOP,0},
/*0x9D*/   {UOP_NOP,0},
/*0x9E*/   {UOP_NOP,0},
/*0x9F*/   {UOP_NOP,0},
/*0xA0*/   {UOP_NOP,0},
/*0xA1*/   {UOP_NOP,0},
/*0xA2*/   {UOP_ZOOM,0},
/*0xA3*/   {UOP_NOP,0},
/*0xA4*/   {UOP_NOP,0},
/*0xA5*/   {UOP_NOP,0},
/*0xA6*/   {UOP_NOP,0},
/*0xA7*/   {UOP_NOP,0},
/*0xA8*/   {UOP_NOP,0},
/*0xA9*/   {UOP_NOP,0},
/*0xAA*/   {UOP_NOP,0},
/*0xAB*/   {UOP_NOP,0},
/*0xAC*/   {UOP_NOP,0},
/*0xAD*/   {UOP_NOP,0},
/*0xAE*/   {UOP_NOP,0},
/*0xAF*/   {UOP_NOP,0},
/*0xB0*/   {UOP_NOP,0},
/*0xB1*/   {UOP_NOP,0},
/*0xB2*/   {UOP_NOP,0},
/*0xB3*/   {UOP_NOP,0},
/*0xB4*/   {UOP_NOP,0},
/*0xB5*/   {UOP_NOP,0},
/*0xB6*/   {UOP_NOP,0},
/*0xB7*/   {UOP_NOP,0},
/*0xB8*/   {UOP_NOP,0},
/*0xB9*/   {UOP_NOP,0},
/*0xBA*/   {UOP_NOP,0},
/*0xBB*/   {UOP_NOP,0},
/*0xBC*/   {UOP_NOP,0},
/*0xBD*/   {UOP_NOP,0},
/*0xBE*/   {UOP_NOP,0},
/*0xBF*/   {UOP_NOP,0},
/*0xC0*/   {UOP_NOP,0},
/*0xC1*/   {UOP_NOP,0},
/*0xC2*/   {UOP_NOP,0},
/*0xC3*/   {UOP_NOP,0},
/*0xC4*/   {UOP_NOP,0},
/*0xC5*/   {UOP_NOP,0},
/*0xC6*/   {UOP_NOP,0},
/*0xC7*/   {UOP_NOP,0},
/*0xC8*/   {UOP_NOP,0},
/*0xC9*/   {UOP_NOP,0},
/*0xCA*/   {UOP_NOP,0},
/*0xCB*/   {UOP_NOP,0},
/*0xCC*/   {UOP_NOP,0},
/*0xCD*/   {UOP_NOP,0},
/*0xCE*/   {UOP_NOP,0},
/*0xCF*/   {UOP_NOP,0},
/*0xD0*/   {UOP_NOP,0},
/*0xD1*/   {UOP_NOP,0},
/*0xD2*/   {UOP_NOP,0},
/*0xD3*/   {UOP_NOP,0},
/*0xD4*/   {UOP_NOP,0},
/*0xD5*/   {UOP_NOP,0},
/*0xD6*/   {UOP_NOP,0},
/*0xD7*/   {UOP_NOP,0},
/*0xD8*/   {UOP_NOP,0},
/*0xD9*/   {UOP_NOP,0},
/*0xDA*/   {UOP_NOP,0},
/*0xDB*/   {UOP_NOP,0},
/*0xDC*/   {UOP_NOP,0},
/*0xDD*/   {UOP_NOP,0},
/*0xDE*/   {UOP_NOP,0},
/*0xDF*/   {UOP_NOP,0},
/*0xE0*/   {UOP_NOP,0},
/*0xE1*/   {UOP_NOP,0},
/*0xE2*/   {UOP_NOP,0},
/*0xE3*/   {UOP_NOP,0},
/*0xE4*/   {UOP_NOP,0},
/*0xE5*/   {UOP_NOP,0},
/*0xE6*/   {UOP_NOP,0},
/*0xE7*/   {UOP_NOP,0},
/*0xE8*/   {UOP_NOP,0},
/*0xE9*/   {UOP_NOP,0},
/*0xEA*/   {UOP_NOP,0},
/*0xEB*/   {UOP_NOP,0},
/*0xEC*/   {UOP_NOP,0},
/*0xED*/   {UOP_NOP,0},
/*0xEE*/   {UOP_NOP,0},
/*0xEF*/   {UOP_NOP,0},
/*0xF0*/   {UOP_NOP,0},
/*0xF1*/   {UOP_NOP,0},
/*0xF2*/   {UOP_NOP,0},
/*0xF3*/   {UOP_NOP,0},
/*0xF4*/   {UOP_NOP,0},
/*0xF5*/   {UOP_NOP,0},
/*0xF6*/   {UOP_NOP,0},
/*0xF7*/   {UOP_NOP,0},
/*0xF8*/   {UOP_NOP,0},
/*0xF9*/   {UOP_NOP,0},
/*0xFA*/   {UOP_NOP,0},
/*0xFB*/   {UOP_NOP,0},
/*0xFC*/   {UOP_NOP,0},
/*0xFD*/   {UOP_NOP,0},
/*0xFE*/   {UOP_NOP,0},
};
#elif defined WISTAR_REMOTE
#define CUSTOM_CODE 0xff00
const INPUTKETMAP NecIrKey[]={
/*0x00*/   {UOP_NOP,0}, 
/*0x01*/   {UOP_NOP,0}, 
/*0x02*/   {UOP_NOP,0}, 
/*0x03*/   {UOP_NOP,0}, 
/*0x04*/   {UOP_NOP,0}, 
/*0x05*/   {UOP_NOP,0}, 
/*0x06*/   {UOP_NOP,0}, 
/*0x07*/   {UOP_NOP,0}, 
/*0x08*/   {UOP_NOP,0}, 
/*0x09*/   {UOP_LEFT,1}, 
/*0x0A*/   {UOP_ENTER,0}, 
/*0x0B*/   {UOP_RIGHT,1}, 
/*0x0C*/   {UOP_NOP,0}, 
/*0x0D*/   {UOP_MUTE,0}, 
/*0x0E*/   {UOP_UP,1}, 
/*0x0F*/   {UOP_RESUME,0},
/*0x10*/   {UOP_NOP,0}, 
/*0x11*/   {UOP_OSD,0},         //UOP_ZOOM
/*0x12*/   {UOP_DOWN,1}, 
/*0x13*/   {UOP_END_PAUSE,0},
/*0x14*/   {UOP_NOP,0}, 
/*0x15*/   {UOP_NTSC_PAL,0},
/*0x16*/   {UOP_AUDIO,0},       //UOP_ANGLE
/*0x17*/   {UOP_STOP,0}, 
/*0x18*/   {UOP_NOP,0}, 
/*0x19*/   {UOP_VOL_PLUS,0},    //UOP_SHUFFLE
/*0x1A*/   {UOP_FAST_FORWARD,0}, 
/*0x1B*/   {UOP_NEXT_CHAP,0}, 
/*0x1C*/   {UOP_NOP,0}, 
/*0x1D*/   {UOP_VOL_MINUS,0},   //UOP_PAUSE
/*0x1E*/   {UOP_FAST_BACKWARD,0}, 
/*0x1F*/   {UOP_PREVIOUS_CHAP,0}, 
/*0x20*/   {UOP_NOP,0}, 
/*0x21*/   {UOP_NOP,0}, 
/*0x22*/   {UOP_NOP,0}, 
/*0x23*/   {UOP_NOP,0}, 
/*0x24*/   {UOP_NOP,0}, 
/*0x25*/   {UOP_NOP,0}, 
/*0x26*/   {UOP_NOP,0}, 
/*0x27*/   {UOP_NOP,0}, 
/*0x28*/   {UOP_NOP,0}, 
/*0x29*/   {UOP_NOP,0}, 
/*0x2A*/   {UOP_NOP,0}, 
/*0x2B*/   {UOP_NOP,0}, 
/*0x2C*/   {UOP_NOP,0}, 
/*0x2D*/   {UOP_NOP,0}, 
/*0x2E*/   {UOP_NOP,0}, 
/*0x2F*/   {UOP_NOP,0}, 
/*0x30*/   {UOP_NOP,0}, 
/*0x31*/   {UOP_NOP,0}, 
/*0x32*/   {UOP_NOP,0}, 
/*0x33*/   {UOP_NOP,0}, 
/*0x34*/   {UOP_NOP,0}, 
/*0x35*/   {UOP_NOP,0}, 
/*0x36*/   {UOP_NOP,0},
/*0x37*/   {UOP_NOP,0},
/*0x38*/   {UOP_NOP,0},
/*0x39*/   {UOP_NOP,0},
/*0x3A*/   {UOP_NOP,0},
/*0x3B*/   {UOP_NOP,0},
/*0x3C*/   {UOP_NOP,0},
/*0x3D*/   {UOP_NOP,0},
/*0x3E*/   {UOP_NOP,0},
/*0x3F*/   {UOP_NOP,0},
/*0x40*/   {UOP_NOP,0}, 
/*0x41*/   {UOP_NOP,0}, 
/*0x42*/   {UOP_NOP,0}, 
/*0x43*/   {UOP_NOP,0}, 
/*0x44*/   {UOP_NOP,0}, 
/*0x45*/   {UOP_NOP,0}, 
/*0x46*/   {UOP_NOP,0}, 
/*0x47*/   {UOP_NOP,0},
/*0x48*/   {UOP_NOP,0}, 
/*0x49*/   {UOP_NOP,0}, 
/*0x4A*/   {UOP_NOP,0}, 
/*0x4B*/   {UOP_NOP,0}, 
/*0x4C*/   {UOP_NOP,0}, 
/*0x4D*/   {UOP_NOP,0}, 
/*0x4E*/   {UOP_NOP,0}, 
/*0x4F*/   {UOP_NOP,0}, 
/*0x50*/   {UOP_NOP,0}, 
/*0x51*/   {UOP_NOP,0}, 
/*0x52*/   {UOP_NOP,0}, 
/*0x53*/   {UOP_NOP,0}, 
/*0x54*/   {UOP_NOP,0}, 
/*0x55*/   {UOP_NOP,0}, 
/*0x56*/   {UOP_NOP,0}, 
/*0x57*/   {UOP_NOP,0}, 
/*0x58*/   {UOP_NOP,0}, 
/*0x59*/   {UOP_NOP,0}, 
/*0x5A*/   {UOP_NOP,0}, 
/*0x5B*/   {UOP_NOP,0},
/*0x5C*/   {UOP_NOP,0},
/*0x5D*/   {UOP_NOP,0},
/*0x5E*/   {UOP_NOP,0},
/*0x5F*/   {UOP_NOP,0},
/*0x60*/   {UOP_NOP,0},
/*0x61*/   {UOP_NOP,0},
/*0x62*/   {UOP_NOP,0},
/*0x63*/   {UOP_NOP,0},
/*0x64*/   {UOP_NOP,0},
/*0x65*/   {UOP_NOP,0},
/*0x66*/   {UOP_NOP,0},
/*0x67*/   {UOP_NOP,0},
/*0x68*/   {UOP_NOP,0},
/*0x69*/   {UOP_NOP,0},
/*0x6A*/   {UOP_NOP,0},
/*0x6B*/   {UOP_NOP,0},
/*0x6C*/   {UOP_NOP,0},
/*0x6D*/   {UOP_NOP,0},
/*0x6E*/   {UOP_NOP,0},
/*0x6F*/   {UOP_NOP,0},
/*0x70*/   {UOP_NOP,0},
/*0x71*/   {UOP_NOP,0},
/*0x72*/   {UOP_NOP,0},
/*0x73*/   {UOP_NOP,0},
/*0x74*/   {UOP_NOP,0},
/*0x75*/   {UOP_NOP,0},
/*0x76*/   {UOP_NOP,0},
/*0x77*/   {UOP_NOP,0},
/*0x78*/   {UOP_NOP,0},
/*0x79*/   {UOP_NOP,0},
/*0x7A*/   {UOP_NOP,0},
/*0x7B*/   {UOP_NOP,0},
/*0x7C*/   {UOP_NOP,0},
/*0x7D*/   {UOP_NOP,0},
/*0x7E*/   {UOP_NOP,0},
/*0x7F*/   {UOP_NOP,0},
/*0x80*/   {UOP_NOP,0},
/*0x81*/   {UOP_NOP,0},
/*0x82*/   {UOP_NOP,0},
/*0x83*/   {UOP_NOP,0},
/*0x84*/   {UOP_NOP,0},
/*0x85*/   {UOP_NOP,0},
/*0x86*/   {UOP_NOP,0},
/*0x87*/   {UOP_NOP,0},
/*0x88*/   {UOP_NOP,0},
/*0x89*/   {UOP_NOP,0},
/*0x8A*/   {UOP_NOP,0},
/*0x8B*/   {UOP_NOP,0},
/*0x8C*/   {UOP_NOP,0},
/*0x8D*/   {UOP_NOP,0},
/*0x8E*/   {UOP_NOP,0},
/*0x8F*/   {UOP_NOP,0},
/*0x90*/   {UOP_NOP,0},
/*0x91*/   {UOP_NOP,0},
/*0x92*/   {UOP_NOP,0},
/*0x93*/   {UOP_NOP,0},
/*0x94*/   {UOP_NOP,0},
/*0x95*/   {UOP_NOP,0},
/*0x96*/   {UOP_NOP,0},
/*0x97*/   {UOP_NOP,0},
/*0x98*/   {UOP_NOP,0},
/*0x99*/   {UOP_NOP,0},
/*0x9A*/   {UOP_NOP,0},
/*0x9B*/   {UOP_NOP,0},
/*0x9C*/   {UOP_NOP,0},
/*0x9D*/   {UOP_NOP,0},
/*0x9E*/   {UOP_NOP,0},
/*0x9F*/   {UOP_NOP,0},
/*0xA0*/   {UOP_NOP,0},
/*0xA1*/   {UOP_NOP,0},
/*0xA2*/   {UOP_NOP,0},
/*0xA3*/   {UOP_NOP,0},
/*0xA4*/   {UOP_NOP,0},
/*0xA5*/   {UOP_NOP,0},
/*0xA6*/   {UOP_NOP,0},
/*0xA7*/   {UOP_NOP,0},
/*0xA8*/   {UOP_NOP,0},
/*0xA9*/   {UOP_NOP,0},
/*0xAA*/   {UOP_NOP,0},
/*0xAB*/   {UOP_NOP,0},
/*0xAC*/   {UOP_NOP,0},
/*0xAD*/   {UOP_NOP,0},
/*0xAE*/   {UOP_NOP,0},
/*0xAF*/   {UOP_NOP,0},
/*0xB0*/   {UOP_NOP,0},
/*0xB1*/   {UOP_NOP,0},
/*0xB2*/   {UOP_NOP,0},
/*0xB3*/   {UOP_NOP,0},
/*0xB4*/   {UOP_NOP,0},
/*0xB5*/   {UOP_NOP,0},
/*0xB6*/   {UOP_NOP,0},
/*0xB7*/   {UOP_NOP,0},
/*0xB8*/   {UOP_NOP,0},
/*0xB9*/   {UOP_NOP,0},
/*0xBA*/   {UOP_NOP,0},
/*0xBB*/   {UOP_NOP,0},
/*0xBC*/   {UOP_NOP,0},
/*0xBD*/   {UOP_NOP,0},
/*0xBE*/   {UOP_NOP,0},
/*0xBF*/   {UOP_NOP,0},
/*0xC0*/   {UOP_NOP,0},
/*0xC1*/   {UOP_NOP,0},
/*0xC2*/   {UOP_NOP,0},
/*0xC3*/   {UOP_NOP,0},
/*0xC4*/   {UOP_NOP,0},
/*0xC5*/   {UOP_NOP,0},
/*0xC6*/   {UOP_NOP,0},
/*0xC7*/   {UOP_NOP,0},
/*0xC8*/   {UOP_NOP,0},
/*0xC9*/   {UOP_NOP,0},
/*0xCA*/   {UOP_NOP,0},
/*0xCB*/   {UOP_NOP,0},
/*0xCC*/   {UOP_NOP,0},
/*0xCD*/   {UOP_NOP,0},
/*0xCE*/   {UOP_NOP,0},
/*0xCF*/   {UOP_NOP,0},
/*0xD0*/   {UOP_NOP,0},
/*0xD1*/   {UOP_NOP,0},
/*0xD2*/   {UOP_NOP,0},
/*0xD3*/   {UOP_NOP,0},
/*0xD4*/   {UOP_NOP,0},
/*0xD5*/   {UOP_NOP,0},
/*0xD6*/   {UOP_NOP,0},
/*0xD7*/   {UOP_NOP,0},
/*0xD8*/   {UOP_NOP,0},
/*0xD9*/   {UOP_NOP,0},
/*0xDA*/   {UOP_NOP,0},
/*0xDB*/   {UOP_NOP,0},
/*0xDC*/   {UOP_NOP,0},
/*0xDD*/   {UOP_NOP,0},
/*0xDE*/   {UOP_NOP,0},
/*0xDF*/   {UOP_NOP,0},
/*0xE0*/   {UOP_NOP,0},
/*0xE1*/   {UOP_NOP,0},
/*0xE2*/   {UOP_NOP,0},
/*0xE3*/   {UOP_NOP,0},
/*0xE4*/   {UOP_NOP,0},
/*0xE5*/   {UOP_NOP,0},
/*0xE6*/   {UOP_NOP,0},
/*0xE7*/   {UOP_NOP,0},
/*0xE8*/   {UOP_NOP,0},
/*0xE9*/   {UOP_NOP,0},
/*0xEA*/   {UOP_NOP,0},
/*0xEB*/   {UOP_NOP,0},
/*0xEC*/   {UOP_NOP,0},
/*0xED*/   {UOP_NOP,0},
/*0xEE*/   {UOP_NOP,0},
/*0xEF*/   {UOP_NOP,0},
/*0xF0*/   {UOP_NOP,0},
/*0xF1*/   {UOP_NOP,0},
/*0xF2*/   {UOP_NOP,0},
/*0xF3*/   {UOP_NOP,0},
/*0xF4*/   {UOP_NOP,0},
/*0xF5*/   {UOP_NOP,0},
/*0xF6*/   {UOP_NOP,0},
/*0xF7*/   {UOP_NOP,0},
/*0xF8*/   {UOP_NOP,0},
/*0xF9*/   {UOP_NOP,0},
/*0xFA*/   {UOP_NOP,0},
/*0xFB*/   {UOP_NOP,0},
/*0xFC*/   {UOP_NOP,0},
/*0xFD*/   {UOP_NOP,0},
/*0xFE*/   {UOP_NOP,0},
};
#elif defined LINPO_REMOTE
#define CUSTOM_CODE (0x0000EF10)
static const INPUTKETMAP NecIrKey[]={
/*0x00*/   {UOP_NOP,0},
/*0x01*/   {UOP_NOP,0},
/*0x02*/   {UOP_NOP,0},
/*0x03*/   {UOP_NOP,0},
/*0x04*/   {UOP_MUTE,0},
/*0x05*/   {UOP_OSD,0},
/*0x06*/   {UOP_NOP,0},
/*0x07*/   {UOP_NOP,0},
/*0x08*/   {UOP_NOP,0},
/*0x09*/   {UOP_ENTER,0},
/*0x0A*/   {UOP_UP,0},
/*0x0B*/   {UOP_DOWN,0},
/*0x0C*/   {UOP_RIGHT,0},
/*0x0D*/   {UOP_LEFT,0},
/*0x0E*/   {UOP_RESUME,0},
/*0x0F*/   {UOP_NOP,0},
/*0x10*/   {UOP_STOP,0},
/*0x11*/   {UOP_VOL_MINUS,0},
/*0x12*/   {UOP_PLAY_PAUSE,0},
/*0x13*/   {UOP_VOL_PLUS,0},
/*0x14*/   {UOP_PREVIOUS_CHAP,0},
/*0x15*/   {UOP_NEXT_CHAP,0},
/*0x16*/   {UOP_NOP,0},
/*0x17*/   {UOP_NOP,0},
/*0x18*/   {UOP_POWER,0},
/*0x19*/   {UOP_NOP,0},
/*0x1A*/   {UOP_NOP,0},
/*0x1B*/   {UOP_NOP,0},
/*0x1C*/   {UOP_NOP,0},
/*0x1D*/   {UOP_NOP,0},
/*0x1E*/   {UOP_NOP,0},
/*0x1F*/   {UOP_NOP,0},
/*0x20*/   {UOP_NOP,0},
/*0x21*/   {UOP_NOP,0},
/*0x22*/   {UOP_NOP,0},
/*0x23*/   {UOP_NOP,0},
/*0x24*/   {UOP_NOP,0},
/*0x25*/   {UOP_NOP,0},
/*0x26*/   {UOP_NOP,0},
/*0x27*/   {UOP_NOP,0},
/*0x28*/   {UOP_NOP,0},
/*0x29*/   {UOP_NOP,0},
/*0x2A*/   {UOP_NOP,0},
/*0x2B*/   {UOP_NOP,0},
/*0x2C*/   {UOP_NOP,0},
/*0x2D*/   {UOP_NOP,0},
/*0x2E*/   {UOP_NOP,0},
/*0x2F*/   {UOP_NOP,0},
/*0x30*/   {UOP_NOP,0},
/*0x31*/   {UOP_NOP,0},
/*0x32*/   {UOP_NOP,0},
/*0x33*/   {UOP_NOP,0},
/*0x34*/   {UOP_NOP,0},
/*0x35*/   {UOP_NOP,0},
/*0x36*/   {UOP_NOP,0},
/*0x37*/   {UOP_NOP,0},
/*0x38*/   {UOP_NOP,0},
/*0x39*/   {UOP_NOP,0},
/*0x3A*/   {UOP_NOP,0},
/*0x3B*/   {UOP_NOP,0},
/*0x3C*/   {UOP_NOP,0},
/*0x3D*/   {UOP_NOP,0},
/*0x3E*/   {UOP_NOP,0},
/*0x3F*/   {UOP_NOP,0},
/*0x40*/   {UOP_NOP,0},
/*0x41*/   {UOP_NOP,0},
/*0x42*/   {UOP_NOP,0},
/*0x43*/   {UOP_NOP,0},
/*0x44*/   {UOP_NOP,0},
/*0x45*/   {UOP_NOP,0},
/*0x46*/   {UOP_NOP,0},
/*0x47*/   {UOP_NOP,0},
/*0x48*/   {UOP_NOP,0},
/*0x49*/   {UOP_NOP,0},
/*0x4A*/   {UOP_NOP,0},
/*0x4B*/   {UOP_NOP,0},
/*0x4C*/   {UOP_NOP,0},
/*0x4D*/   {UOP_NOP,0},
/*0x4E*/   {UOP_NOP,0},
/*0x4F*/   {UOP_NOP,0},
/*0x50*/   {UOP_NOP,0},
/*0x51*/   {UOP_NOP,0},
/*0x52*/   {UOP_NOP,0},
/*0x53*/   {UOP_NOP,0},
/*0x54*/   {UOP_NOP,0},
/*0x55*/   {UOP_NOP,0},
/*0x56*/   {UOP_NOP,0},
/*0x57*/   {UOP_NOP,0},
/*0x58*/   {UOP_NOP,0},
/*0x59*/   {UOP_NOP,0},
/*0x5A*/   {UOP_NOP,0},
/*0x5B*/   {UOP_NOP,0},
/*0x5C*/   {UOP_NOP,0},
/*0x5D*/   {UOP_NOP,0},
/*0x5E*/   {UOP_NOP,0},
/*0x5F*/   {UOP_NOP,0},
/*0x60*/   {UOP_NOP,0},
/*0x61*/   {UOP_NOP,0},
/*0x62*/   {UOP_NOP,0},
/*0x63*/   {UOP_NOP,0},
/*0x64*/   {UOP_NOP,0},
/*0x65*/   {UOP_NOP,0},
/*0x66*/   {UOP_NOP,0},
/*0x67*/   {UOP_NOP,0},
/*0x68*/   {UOP_NOP,0},
/*0x69*/   {UOP_NOP,0},
/*0x6A*/   {UOP_NOP,0},
/*0x6B*/   {UOP_NOP,0},
/*0x6C*/   {UOP_NOP,0},
/*0x6D*/   {UOP_NOP,0},
/*0x6E*/   {UOP_NOP,0},
/*0x6F*/   {UOP_NOP,0},
/*0x70*/   {UOP_NOP,0},
/*0x71*/   {UOP_NOP,0},
/*0x72*/   {UOP_NOP,0},
/*0x73*/   {UOP_NOP,0},
/*0x74*/   {UOP_NOP,0},
/*0x75*/   {UOP_NOP,0},
/*0x76*/   {UOP_NOP,0},
/*0x77*/   {UOP_NOP,0},
/*0x78*/   {UOP_NOP,0},
/*0x79*/   {UOP_NOP,0},
/*0x7A*/   {UOP_NOP,0},
/*0x7B*/   {UOP_NOP,0},
/*0x7C*/   {UOP_NOP,0},
/*0x7D*/   {UOP_NOP,0},
/*0x7E*/   {UOP_NOP,0},
/*0x7F*/   {UOP_NOP,0},
/*0x80*/   {UOP_NOP,0},
/*0x81*/   {UOP_NOP,0},
/*0x82*/   {UOP_NOP,0},
/*0x83*/   {UOP_NOP,0},
/*0x84*/   {UOP_NOP,0},
/*0x85*/   {UOP_NOP,0},
/*0x86*/   {UOP_NOP,0},
/*0x87*/   {UOP_NOP,0},
/*0x88*/   {UOP_NOP,0},
/*0x89*/   {UOP_NOP,0},
/*0x8A*/   {UOP_NOP,0},
/*0x8B*/   {UOP_NOP,0},
/*0x8C*/   {UOP_NOP,0},
/*0x8D*/   {UOP_NOP,0},
/*0x8E*/   {UOP_NOP,0},
/*0x8F*/   {UOP_NOP,0},
/*0x90*/   {UOP_NOP,0},
/*0x91*/   {UOP_NOP,0},
/*0x92*/   {UOP_NOP,0},
/*0x93*/   {UOP_NOP,0},
/*0x94*/   {UOP_NOP,0},
/*0x95*/   {UOP_NOP,0},
/*0x96*/   {UOP_NOP,0},
/*0x97*/   {UOP_NOP,0},
/*0x98*/   {UOP_NOP,0},
/*0x99*/   {UOP_NOP,0},
/*0x9A*/   {UOP_NOP,0},
/*0x9B*/   {UOP_NOP,0},
/*0x9C*/   {UOP_NOP,0},
/*0x9D*/   {UOP_NOP,0},
/*0x9E*/   {UOP_NOP,0},
/*0x9F*/   {UOP_NOP,0},
/*0xA0*/   {UOP_NOP,0},
/*0xA1*/   {UOP_NOP,0},
/*0xA2*/   {UOP_NOP,0},
/*0xA3*/   {UOP_NOP,0},
/*0xA4*/   {UOP_NOP,0},
/*0xA5*/   {UOP_NOP,0},
/*0xA6*/   {UOP_NOP,0},
/*0xA7*/   {UOP_NOP,0},
/*0xA8*/   {UOP_NOP,0},
/*0xA9*/   {UOP_NOP,0},
/*0xAA*/   {UOP_NOP,0},
/*0xAB*/   {UOP_NOP,0},
/*0xAC*/   {UOP_NOP,0},
/*0xAD*/   {UOP_NOP,0},
/*0xAE*/   {UOP_NOP,0},
/*0xAF*/   {UOP_NOP,0},
/*0xB0*/   {UOP_NOP,0},
/*0xB1*/   {UOP_NOP,0},
/*0xB2*/   {UOP_NOP,0},
/*0xB3*/   {UOP_NOP,0},
/*0xB4*/   {UOP_NOP,0},
/*0xB5*/   {UOP_NOP,0},
/*0xB6*/   {UOP_NOP,0},
/*0xB7*/   {UOP_NOP,0},
/*0xB8*/   {UOP_NOP,0},
/*0xB9*/   {UOP_NOP,0},
/*0xBA*/   {UOP_NOP,0},
/*0xBB*/   {UOP_NOP,0},
/*0xBC*/   {UOP_NOP,0},
/*0xBD*/   {UOP_NOP,0},
/*0xBE*/   {UOP_NOP,0},
/*0xBF*/   {UOP_NOP,0},
/*0xC0*/   {UOP_NOP,0},
/*0xC1*/   {UOP_NOP,0},
/*0xC2*/   {UOP_NOP,0},
/*0xC3*/   {UOP_NOP,0},
/*0xC4*/   {UOP_NOP,0},
/*0xC5*/   {UOP_NOP,0},
/*0xC6*/   {UOP_NOP,0},
/*0xC7*/   {UOP_NOP,0},
/*0xC8*/   {UOP_NOP,0},
/*0xC9*/   {UOP_NOP,0},
/*0xCA*/   {UOP_NOP,0},
/*0xCB*/   {UOP_NOP,0},
/*0xCC*/   {UOP_NOP,0},
/*0xCD*/   {UOP_NOP,0},
/*0xCE*/   {UOP_NOP,0},
/*0xCF*/   {UOP_NOP,0},
/*0xD0*/   {UOP_NOP,0},
/*0xD1*/   {UOP_NOP,0},
/*0xD2*/   {UOP_NOP,0},
/*0xD3*/   {UOP_NOP,0},
/*0xD4*/   {UOP_NOP,0},
/*0xD5*/   {UOP_NOP,0},
/*0xD6*/   {UOP_NOP,0},
/*0xD7*/   {UOP_NOP,0},
/*0xD8*/   {UOP_NOP,0},
/*0xD9*/   {UOP_NOP,0},
/*0xDA*/   {UOP_NOP,0},
/*0xDB*/   {UOP_NOP,0},
/*0xDC*/   {UOP_NOP,0},
/*0xDD*/   {UOP_NOP,0},
/*0xDE*/   {UOP_NOP,0},
/*0xDF*/   {UOP_NOP,0},
/*0xE0*/   {UOP_NOP,0},
/*0xE1*/   {UOP_NOP,0},
/*0xE2*/   {UOP_NOP,0},
/*0xE3*/   {UOP_NOP,0},
/*0xE4*/   {UOP_NOP,0},
/*0xE5*/   {UOP_NOP,0},
/*0xE6*/   {UOP_NOP,0},
/*0xE7*/   {UOP_NOP,0},
/*0xE8*/   {UOP_NOP,0},
/*0xE9*/   {UOP_NOP,0},
/*0xEA*/   {UOP_NOP,0},
/*0xEB*/   {UOP_NOP,0},
/*0xEC*/   {UOP_NOP,0},
/*0xED*/   {UOP_NOP,0},
/*0xEE*/   {UOP_NOP,0},
/*0xEF*/   {UOP_NOP,0},
/*0xF0*/   {UOP_NOP,0},
/*0xF1*/   {UOP_NOP,0},
/*0xF2*/   {UOP_NOP,0},
/*0xF3*/   {UOP_NOP,0},
/*0xF4*/   {UOP_NOP,0},
/*0xF5*/   {UOP_NOP,0},
/*0xF6*/   {UOP_NOP,0},
/*0xF7*/   {UOP_NOP,0},
/*0xF8*/   {UOP_NOP,0},
/*0xF9*/   {UOP_NOP,0},
/*0xFA*/   {UOP_NOP,0},
/*0xFB*/   {UOP_NOP,0},
/*0xFC*/   {UOP_NOP,0},
/*0xFD*/   {UOP_NOP,0},
/*0xFE*/   {UOP_NOP,0},
};       
#elif defined AML_VERSION_1
#define CUSTOM_CODE	0xFF00
const INPUTKETMAP NecIrKey[]={
/*0x00*/   {UOP_1,0},
/*0x01*/   {UOP_2,0},
/*0x02*/   {UOP_3,0},
/*0x03*/   {UOP_4,0},
/*0x04*/   {UOP_5,0},
/*0x05*/   {UOP_SLIDE_SHOW,0},  //UOP_6
/*0x06*/   {UOP_MUSIC,0},       //UOP_7
/*0x07*/   {UOP_8,0},
/*0x08*/   {UOP_MOVIE,0},       //UOP_9
/*0x09*/   {UOP_CLEAR,0},
/*0x0A*/   {UOP_ZOOM,0},
/*0x0B*/   {UOP_PHOTO,0},       //UOP_0
/*0x0C*/   {UOP_POWER,0},
/*0x0D*/   {UOP_OPEN_CLOSE,0},
/*0x0E*/   {UOP_ENTER,0},
/*0x0F*/   {UOP_NOP,0},
/*0x10*/   {UOP_UP,1},
/*0x11*/   {UOP_DOWN,1},
/*0x12*/   {UOP_LEFT,1},
/*0x13*/   {UOP_RIGHT,1},
/*0x14*/   {UOP_SETUP,0},
/*0x15*/   {UOP_TITLE,0},
/*0x16*/   {UOP_MENU,0},
/*0x17*/   {UOP_PBC,0},
/*0x18*/   {UOP_TIME_PLAY,0},
/*0x19*/   {UOP_MUTE,0},
/*0x1A*/   {UOP_VOL_MINUS,0},   //UOP_PAUSE
/*0x1B*/   {UOP_VOL_PLUS,0},    //UOP_SHUFFLE
/*0x1C*/   {UOP_ANGLE,0},
/*0x1D*/   {UOP_PROGRAM,0},
/*0x1E*/   {UOP_SUBPICTURE,0},
/*0x1F*/   {UOP_AUDIO,0},
/*0x20*/   {UOP_NOP,0},
/*0x21*/   {UOP_NOP,0},
/*0x22*/   {UOP_NOP,0},
/*0x23*/   {UOP_NOP,0},
/*0x24*/   {UOP_NOP,0},
/*0x25*/   {UOP_NOP,0},
/*0x26*/   {UOP_NOP,0},
/*0x27*/   {UOP_NOP,0},
/*0x28*/   {UOP_NOP,0},
/*0x29*/   {UOP_NOP,0},
/*0x2A*/   {UOP_NOP,0},
/*0x2B*/   {UOP_NOP,0},
/*0x2C*/   {UOP_NOP,0},
/*0x2D*/   {UOP_NOP,0},
/*0x2E*/   {UOP_NOP,0},
/*0x2F*/   {UOP_NOP,0},
/*0x30*/   {UOP_NOP,0},
/*0x31*/   {UOP_NOP,0},
/*0x32*/   {UOP_NOP,0},
/*0x33*/   {UOP_NOP,0},
/*0x34*/   {UOP_NOP,0},
/*0x35*/   {UOP_NOP,0},
/*0x36*/   {UOP_NOP,0},
/*0x37*/   {UOP_NOP,0},
/*0x38*/   {UOP_NOP,0},
/*0x39*/   {UOP_NOP,0},
/*0x3A*/   {UOP_NOP,0},
/*0x3B*/   {UOP_NOP,0},
/*0x3C*/   {UOP_NOP,0},
/*0x3D*/   {UOP_NOP,0},
/*0x3E*/   {UOP_NOP,0},
/*0x3F*/   {UOP_NOP,0},
/*0x40*/   {UOP_FAST_BACKWARD,0},
/*0x41*/   {UOP_FAST_FORWARD,0},
/*0x42*/   {UOP_PREVIOUS_CHAP,0},
/*0x43*/   {UOP_NEXT_CHAP,0},
/*0x44*/   {UOP_END_PAUSE,0},
/*0x45*/   {UOP_STOP,0},
/*0x46*/   {UOP_NOP,0},
/*0x47*/   {UOP_NOP,0},
/*0x48*/   {UOP_REPEAT,0},
/*0x49*/   {UOP_TIME_CHANGE2,0},
/*0x4A*/   {UOP_RESUME,0},
/*0x4B*/   {UOP_OSD,0},
/*0x4C*/   {UOP_NTSC_PAL,0},
/*0x4D*/   {UOP_HD,0},
/*0x4E*/   {UOP_VGA,0},
/*0x4F*/   {UOP_NOP,0},
/*0x50*/   {UOP_NOP,0},
/*0x51*/   {UOP_NOP,0},
/*0x52*/   {UOP_NOP,0},
/*0x53*/   {UOP_NOP,0},
/*0x54*/   {UOP_NOP,0},
/*0x55*/   {UOP_NOP,0},
/*0x56*/   {UOP_NOP,0},
/*0x57*/   {UOP_NOP,0},
/*0x58*/   {UOP_NOP,0},
/*0x59*/   {UOP_NOP,0},
/*0x5A*/   {UOP_NOP,0},
/*0x5B*/   {UOP_NOP,0},
/*0x5C*/   {UOP_NOP,0},
/*0x5D*/   {UOP_NOP,0},
/*0x5E*/   {UOP_NOP,0},
/*0x5F*/   {UOP_NOP,0},
/*0x60*/   {UOP_NOP,0},
/*0x61*/   {UOP_NOP,0},
/*0x62*/   {UOP_NOP,0},
/*0x63*/   {UOP_NOP,0},
/*0x64*/   {UOP_NOP,0},
/*0x65*/   {UOP_NOP,0},
/*0x66*/   {UOP_NOP,0},
/*0x67*/   {UOP_NOP,0},
/*0x68*/   {UOP_NOP,0},
/*0x69*/   {UOP_NOP,0},
/*0x6A*/   {UOP_NOP,0},
/*0x6B*/   {UOP_NOP,0},
/*0x6C*/   {UOP_NOP,0},
/*0x6D*/   {UOP_NOP,0},
/*0x6E*/   {UOP_NOP,0},
/*0x6F*/   {UOP_NOP,0},
/*0x70*/   {UOP_NOP,0},
/*0x71*/   {UOP_NOP,0},
/*0x72*/   {UOP_NOP,0},
/*0x73*/   {UOP_NOP,0},
/*0x74*/   {UOP_NOP,0},
/*0x75*/   {UOP_NOP,0},
/*0x76*/   {UOP_NOP,0},
/*0x77*/   {UOP_NOP,0},
/*0x78*/   {UOP_NOP,0},
/*0x79*/   {UOP_NOP,0},
/*0x7A*/   {UOP_NOP,0},
/*0x7B*/   {UOP_NOP,0},
/*0x7C*/   {UOP_NOP,0},
/*0x7D*/   {UOP_NOP,0},
/*0x7E*/   {UOP_NOP,0},
/*0x7F*/   {UOP_NOP,0},
/*0x80*/   {UOP_NOP,0},
/*0x81*/   {UOP_NOP,0},
/*0x82*/   {UOP_NOP,0},
/*0x83*/   {UOP_NOP,0},
/*0x84*/   {UOP_NOP,0},
/*0x85*/   {UOP_NOP,0},
/*0x86*/   {UOP_NOP,0},
/*0x87*/   {UOP_NOP,0},
/*0x88*/   {UOP_NOP,0},
/*0x89*/   {UOP_NOP,0},
/*0x8A*/   {UOP_NOP,0},
/*0x8B*/   {UOP_NOP,0},
/*0x8C*/   {UOP_NOP,0},
/*0x8D*/   {UOP_NOP,0},
/*0x8E*/   {UOP_NOP,0},
/*0x8F*/   {UOP_NOP,0},
/*0x90*/   {UOP_NOP,0},
/*0x91*/   {UOP_NOP,0},
/*0x92*/   {UOP_NOP,0},
/*0x93*/   {UOP_NOP,0},
/*0x94*/   {UOP_NOP,0},
/*0x95*/   {UOP_NOP,0},
/*0x96*/   {UOP_NOP,0},
/*0x97*/   {UOP_NOP,0},
/*0x98*/   {UOP_NOP,0},
/*0x99*/   {UOP_NOP,0},
/*0x9A*/   {UOP_NOP,0},
/*0x9B*/   {UOP_NOP,0},
/*0x9C*/   {UOP_NOP,0},
/*0x9D*/   {UOP_NOP,0},
/*0x9E*/   {UOP_NOP,0},
/*0x9F*/   {UOP_NOP,0},
/*0xA0*/   {UOP_NOP,0},
/*0xA1*/   {UOP_NOP,0},
/*0xA2*/   {UOP_NOP,0},
/*0xA3*/   {UOP_NOP,0},
/*0xA4*/   {UOP_NOP,0},
/*0xA5*/   {UOP_NOP,0},
/*0xA6*/   {UOP_NOP,0},
/*0xA7*/   {UOP_NOP,0},
/*0xA8*/   {UOP_NOP,0},
/*0xA9*/   {UOP_NOP,0},
/*0xAA*/   {UOP_NOP,0},
/*0xAB*/   {UOP_NOP,0},
/*0xAC*/   {UOP_NOP,0},
/*0xAD*/   {UOP_NOP,0},
/*0xAE*/   {UOP_NOP,0},
/*0xAF*/   {UOP_NOP,0},
/*0xB0*/   {UOP_NOP,0},
/*0xB1*/   {UOP_NOP,0},
/*0xB2*/   {UOP_NOP,0},
/*0xB3*/   {UOP_NOP,0},
/*0xB4*/   {UOP_NOP,0},
/*0xB5*/   {UOP_NOP,0},
/*0xB6*/   {UOP_NOP,0},
/*0xB7*/   {UOP_NOP,0},
/*0xB8*/   {UOP_NOP,0},
/*0xB9*/   {UOP_NOP,0},
/*0xBA*/   {UOP_NOP,0},
/*0xBB*/   {UOP_NOP,0},
/*0xBC*/   {UOP_NOP,0},
/*0xBD*/   {UOP_NOP,0},
/*0xBE*/   {UOP_NOP,0},
/*0xBF*/   {UOP_NOP,0},
/*0xC0*/   {UOP_NOP,0},
/*0xC1*/   {UOP_NOP,0},
/*0xC2*/   {UOP_NOP,0},
/*0xC3*/   {UOP_NOP,0},
/*0xC4*/   {UOP_NOP,0},
/*0xC5*/   {UOP_NOP,0},
/*0xC6*/   {UOP_NOP,0},
/*0xC7*/   {UOP_NOP,0},
/*0xC8*/   {UOP_NOP,0},
/*0xC9*/   {UOP_NOP,0},
/*0xCA*/   {UOP_NOP,0},
/*0xCB*/   {UOP_NOP,0},
/*0xCC*/   {UOP_NOP,0},
/*0xCD*/   {UOP_NOP,0},
/*0xCE*/   {UOP_NOP,0},
/*0xCF*/   {UOP_NOP,0},
/*0xD0*/   {UOP_NOP,0},
/*0xD1*/   {UOP_NOP,0},
/*0xD2*/   {UOP_NOP,0},
/*0xD3*/   {UOP_NOP,0},
/*0xD4*/   {UOP_NOP,0},
/*0xD5*/   {UOP_NOP,0},
/*0xD6*/   {UOP_NOP,0},
/*0xD7*/   {UOP_NOP,0},
/*0xD8*/   {UOP_NOP,0},
/*0xD9*/   {UOP_NOP,0},
/*0xDA*/   {UOP_NOP,0},
/*0xDB*/   {UOP_NOP,0},
/*0xDC*/   {UOP_NOP,0},
/*0xDD*/   {UOP_NOP,0},
/*0xDE*/   {UOP_NOP,0},
/*0xDF*/   {UOP_NOP,0},
/*0xE0*/   {UOP_NOP,0},
/*0xE1*/   {UOP_NOP,0},
/*0xE2*/   {UOP_NOP,0},
/*0xE3*/   {UOP_NOP,0},
/*0xE4*/   {UOP_NOP,0},
/*0xE5*/   {UOP_NOP,0},
/*0xE6*/   {UOP_NOP,0},
/*0xE7*/   {UOP_NOP,0},
/*0xE8*/   {UOP_NOP,0},
/*0xE9*/   {UOP_NOP,0},
/*0xEA*/   {UOP_NOP,0},
/*0xEB*/   {UOP_NOP,0},
/*0xEC*/   {UOP_NOP,0},
/*0xED*/   {UOP_NOP,0},
/*0xEE*/   {UOP_NOP,0},
/*0xEF*/   {UOP_NOP,0},
/*0xF0*/   {UOP_NOP,0},
/*0xF1*/   {UOP_NOP,0},
/*0xF2*/   {UOP_NOP,0},
/*0xF3*/   {UOP_NOP,0},
/*0xF4*/   {UOP_NOP,0},
/*0xF5*/   {UOP_NOP,0},
/*0xF6*/   {UOP_NOP,0},
/*0xF7*/   {UOP_NOP,0},
/*0xF8*/   {UOP_NOP,0},
/*0xF9*/   {UOP_NOP,0},
/*0xFA*/   {UOP_NOP,0},
/*0xFB*/   {UOP_NOP,0},
/*0xFC*/   {UOP_NOP,0},
/*0xFD*/   {UOP_NOP,0},
/*0xFE*/   {UOP_NOP,0},
};
#elif defined KOREAR_REMOTE
#define CUSTOM_CODE	0xc80f
const INPUTKETMAP NecIrKey[]={
/*0x00*/   {UOP_UP,1}, //up or previous
/*0x01*/   {UOP_DOWN,1}, //down or next
/*0x02*/   {UOP_RIGHT,0}, //right or fastforward
/*0x03*/   {UOP_LEFT,0}, //left or fastbackward
/*0x04*/   {UOP_NOP,0}, 
/*0x05*/   {UOP_NOP,0}, 
/*0x06*/   {UOP_NOP,0}, 
/*0x07*/   {UOP_NOP,0}, 
/*0x08*/   {UOP_NOP,0}, 
/*0x09*/   {UOP_NOP,0}, 
/*0x0A*/   {UOP_PAUSE,1}, 
/*0x0B*/   {UOP_NOP,0}, 
/*0x0C*/   {UOP_NOP,0}, 
/*0x0D*/   {UOP_NOP,0}, 
/*0x0E*/   {UOP_STOP},//stop when playing
/*0x0F*/   {UOP_NOP,0}, 
/*0x10*/   {UOP_NOP,0}, 
/*0x11*/   {UOP_OSD,0}, //show info when playing
/*0x12*/   {UOP_NOP,0}, 
/*0x13*/   {UOP_NOP,0}, 
/*0x14*/   {UOP_NOP,0}, 
/*0x15*/   {UOP_ZOOM,0}, 
/*0x16*/   {UOP_NOP,0}, 
/*0x17*/   {UOP_NOP,0}, 
/*0x18*/   {UOP_NOP,0}, 
/*0x19*/   {UOP_NOP,0}, 
/*0x1A*/   {UOP_NOP,0}, 
/*0x1B*/   {UOP_NOP,0}, 
/*0x1C*/   {UOP_NOP,0}, 
/*0x1D*/   {UOP_NOP,0},   
/*0x1E*/   {UOP_NOP,0}, 
/*0x1F*/   {UOP_NOP,0},   
/*0x20*/   {UOP_NOP,0}, 
/*0x21*/   {UOP_NOP,0}, 
/*0x22*/   {UOP_NOP,0}, 
/*0x23*/   {UOP_NOP,0}, 
/*0x24*/   {UOP_NOP,0}, 
/*0x25*/   {UOP_NOP,0}, 
/*0x26*/   {UOP_NOP,0}, 
/*0x27*/   {UOP_NOP,0}, 
/*0x28*/   {UOP_NOP,0}, 
/*0x29*/   {UOP_NOP,0}, 
/*0x2A*/   {UOP_NOP,0},
/*0x2B*/   {UOP_NOP,0},
/*0x2C*/   {UOP_NOP,0},
/*0x2D*/   {UOP_NOP,0},
/*0x2E*/   {UOP_NOP,0},
/*0x2F*/   {UOP_NOP,0},
/*0x30*/   {UOP_NOP,0},
/*0x31*/   {UOP_NOP,0},
/*0x32*/   {UOP_NOP,0},
/*0x33*/   {UOP_NOP,0},
/*0x34*/   {UOP_NOP,0},
/*0x35*/   {UOP_NOP,0},
/*0x36*/   {UOP_NOP,0},
/*0x37*/   {UOP_NOP,0},
/*0x38*/   {UOP_NOP,0},
/*0x39*/   {UOP_NOP,0},
/*0x3A*/   {UOP_NOP,0},
/*0x3B*/   {UOP_NOP,0},
/*0x3C*/   {UOP_NOP,0},
/*0x3D*/   {UOP_NOP,0},
/*0x3E*/   {UOP_NOP,0},
/*0x3F*/   {UOP_NOP,0},
/*0x40*/   {UOP_NOP,0}, 
/*0x41*/   {UOP_NOP,0}, 
/*0x42*/   {UOP_NOP,0}, 
/*0x43*/   {UOP_RESUME,0},//stop playing and go back to the filetype select
/*0x44*/   {UOP_ENTER,0}, //enter new dir,or start playing
/*0x45*/   {UOP_NOP,0}, 
/*0x46*/   {UOP_NOP,0}, 
/*0x47*/   {UOP_NOP,0}, 
/*0x48*/   {UOP_NOP,0},    
/*0x49*/   {UOP_NOP,0}, 
/*0x4A*/   {UOP_NOP,0}, 
/*0x4B*/   {UOP_NOP,0}, 
/*0x4C*/   {UOP_NOP,0}, 
/*0x4D*/   {UOP_AUDIO,0},     //BACK MUSIC  
/*0x4E*/   {UOP_NOP,0}, 
/*0x4F*/   {UOP_NOP,0}, 
/*0x50*/   {UOP_NOP,0},    
/*0x51*/   {UOP_NOP,0},    
/*0x52*/   {UOP_NOP,0}, 
/*0x53*/   {UOP_NOP,0}, 
/*0x54*/   {UOP_NOP,0}, 
/*0x55*/   {UOP_NOP,0},
/*0x56*/   {UOP_NOP,0},
/*0x57*/   {UOP_NOP,0},
/*0x58*/   {UOP_NOP,0},
/*0x59*/   {UOP_NOP,0},
/*0x5A*/   {UOP_NOP,0},
/*0x5B*/   {UOP_NOP,0},
/*0x5C*/   {UOP_NOP,0},
/*0x5D*/   {UOP_NOP,0},
/*0x5E*/   {UOP_NOP,0},
/*0x5F*/   {UOP_NOP,0},
/*0x60*/   {UOP_NOP,0},
/*0x61*/   {UOP_NOP,0},
/*0x62*/   {UOP_NOP,0},
/*0x63*/   {UOP_NOP,0},
/*0x64*/   {UOP_NOP,0},
/*0x65*/   {UOP_NOP,0},
/*0x66*/   {UOP_NOP,0},
/*0x67*/   {UOP_NOP,0},
/*0x68*/   {UOP_NOP,0},
/*0x69*/   {UOP_NOP,0},
/*0x6A*/   {UOP_NOP,0},
/*0x6B*/   {UOP_NOP,0},
/*0x6C*/   {UOP_NOP,0},
/*0x6D*/   {UOP_NOP,0},
/*0x6E*/   {UOP_NOP,0},
/*0x6F*/   {UOP_NOP,0},
/*0x70*/   {UOP_NOP,0},
/*0x71*/   {UOP_NOP,0},
/*0x72*/   {UOP_NOP,0},
/*0x73*/   {UOP_NOP,0},
/*0x74*/   {UOP_NOP,0},
/*0x75*/   {UOP_NOP,0},
/*0x76*/   {UOP_NOP,0},
/*0x77*/   {UOP_NOP,0},
/*0x78*/   {UOP_NOP,0},
/*0x79*/   {UOP_NOP,0},
/*0x7A*/   {UOP_NOP,0},
/*0x7B*/   {UOP_NOP,0},
/*0x7C*/   {UOP_NOP,0},
/*0x7D*/   {UOP_NOP,0},
/*0x7E*/   {UOP_NOP,0},
/*0x7F*/   {UOP_NOP,0},
/*0x80*/   {UOP_NOP,0},
/*0x81*/   {UOP_NOP,0},
/*0x82*/   {UOP_NOP,0},
/*0x83*/   {UOP_NOP,0},
/*0x84*/   {UOP_NOP,0},
/*0x85*/   {UOP_NOP,0},
/*0x86*/   {UOP_NOP,0},
/*0x87*/   {UOP_NOP,0},
/*0x88*/   {UOP_NOP,0},
/*0x89*/   {UOP_NOP,0},
/*0x8A*/   {UOP_NOP,0},
/*0x8B*/   {UOP_NOP,0},
/*0x8C*/   {UOP_NOP,0},
/*0x8D*/   {UOP_NOP,0},
/*0x8E*/   {UOP_NOP,0},
/*0x8F*/   {UOP_NOP,0},
/*0x90*/   {UOP_NOP,0},
/*0x91*/   {UOP_NOP,0},
/*0x92*/   {UOP_NOP,0},
/*0x93*/   {UOP_NOP,0},
/*0x94*/   {UOP_NOP,0},
/*0x95*/   {UOP_NOP,0},
/*0x96*/   {UOP_NOP,0},
/*0x97*/   {UOP_NOP,0},
/*0x98*/   {UOP_NOP,0},
/*0x99*/   {UOP_NOP,0},
/*0x9A*/   {UOP_NOP,0},
/*0x9B*/   {UOP_NOP,0},
/*0x9C*/   {UOP_NOP,0},
/*0x9D*/   {UOP_NOP,0},
/*0x9E*/   {UOP_NOP,0},
/*0x9F*/   {UOP_NOP,0},
/*0xA0*/   {UOP_NOP,0},
/*0xA1*/   {UOP_NOP,0},
/*0xA2*/   {UOP_NOP,0},
/*0xA3*/   {UOP_NOP,0},
/*0xA4*/   {UOP_NOP,0},
/*0xA5*/   {UOP_NOP,0},
/*0xA6*/   {UOP_NOP,0},
/*0xA7*/   {UOP_NOP,0},
/*0xA8*/   {UOP_NOP,0},
/*0xA9*/   {UOP_NOP,0},
/*0xAA*/   {UOP_NOP,0},
/*0xAB*/   {UOP_NOP,0},
/*0xAC*/   {UOP_NOP,0},
/*0xAD*/   {UOP_NOP,0},
/*0xAE*/   {UOP_NOP,0},
/*0xAF*/   {UOP_NOP,0},
/*0xB0*/   {UOP_NOP,0},
/*0xB1*/   {UOP_NOP,0},
/*0xB2*/   {UOP_NOP,0},
/*0xB3*/   {UOP_NOP,0},
/*0xB4*/   {UOP_NOP,0},
/*0xB5*/   {UOP_NOP,0},
/*0xB6*/   {UOP_NOP,0},
/*0xB7*/   {UOP_NOP,0},
/*0xB8*/   {UOP_NOP,0},
/*0xB9*/   {UOP_NOP,0},
/*0xBA*/   {UOP_NOP,0},
/*0xBB*/   {UOP_NOP,0},
/*0xBC*/   {UOP_NOP,0},
/*0xBD*/   {UOP_NOP,0},
/*0xBE*/   {UOP_NOP,0},
/*0xBF*/   {UOP_NOP,0},
/*0xC0*/   {UOP_NOP,0},
/*0xC1*/   {UOP_NOP,0},
/*0xC2*/   {UOP_NOP,0},
/*0xC3*/   {UOP_NOP,0},
/*0xC4*/   {UOP_NOP,0},
/*0xC5*/   {UOP_NOP,0},
/*0xC6*/   {UOP_NOP,0},
/*0xC7*/   {UOP_NOP,0},
/*0xC8*/   {UOP_NOP,0},
/*0xC9*/   {UOP_NOP,0},
/*0xCA*/   {UOP_NOP,0},
/*0xCB*/   {UOP_NOP,0},
/*0xCC*/   {UOP_NOP,0},
/*0xCD*/   {UOP_NOP,0},
/*0xCE*/   {UOP_NOP,0},
/*0xCF*/   {UOP_NOP,0},
/*0xD0*/   {UOP_NOP,0},
/*0xD1*/   {UOP_NOP,0},
/*0xD2*/   {UOP_NOP,0},
/*0xD3*/   {UOP_NOP,0},
/*0xD4*/   {UOP_NOP,0},
/*0xD5*/   {UOP_NOP,0},
/*0xD6*/   {UOP_NOP,0},
/*0xD7*/   {UOP_NOP,0},
/*0xD8*/   {UOP_NOP,0},
/*0xD9*/   {UOP_NOP,0},
/*0xDA*/   {UOP_NOP,0},
/*0xDB*/   {UOP_NOP,0},
/*0xDC*/   {UOP_NOP,0},
/*0xDD*/   {UOP_NOP,0},
/*0xDE*/   {UOP_NOP,0},
/*0xDF*/   {UOP_NOP,0},
/*0xE0*/   {UOP_NOP,0},
/*0xE1*/   {UOP_NOP,0},
/*0xE2*/   {UOP_NOP,0},
/*0xE3*/   {UOP_NOP,0},
/*0xE4*/   {UOP_NOP,0},
/*0xE5*/   {UOP_NOP,0},
/*0xE6*/   {UOP_NOP,0},
/*0xE7*/   {UOP_NOP,0},
/*0xE8*/   {UOP_NOP,0},
/*0xE9*/   {UOP_NOP,0},
/*0xEA*/   {UOP_NOP,0},
/*0xEB*/   {UOP_NOP,0},
/*0xEC*/   {UOP_NOP,0},
/*0xED*/   {UOP_NOP,0},
/*0xEE*/   {UOP_NOP,0},
/*0xEF*/   {UOP_NOP,0},
/*0xF0*/   {UOP_NOP,0},
/*0xF1*/   {UOP_NOP,0},
/*0xF2*/   {UOP_NOP,0},
/*0xF3*/   {UOP_NOP,0},
/*0xF4*/   {UOP_NOP,0},
/*0xF5*/   {UOP_NOP,0},
/*0xF6*/   {UOP_NOP,0},
/*0xF7*/   {UOP_NOP,0},
/*0xF8*/   {UOP_NOP,0},
/*0xF9*/   {UOP_NOP,0},
/*0xFA*/   {UOP_NOP,0},
/*0xFB*/   {UOP_NOP,0},
/*0xFC*/   {UOP_NOP,0},
/*0xFD*/   {UOP_NOP,0},
/*0xFE*/   {UOP_NOP,0},
};
#else
#define CUSTOM_CODE	0xFF00
const INPUTKETMAP NecIrKey[]={
/*0x00*/   {UOP_NOP,0}, 
/*0x01*/   {UOP_NOP,0}, 
/*0x02*/   {UOP_NOP,0}, 
/*0x03*/   {UOP_VOL_PLUS,1},   //UOP_SHUFFLE
/*0x04*/   {UOP_NOP,0}, 
/*0x05*/   {UOP_NOP,0}, 
/*0x06*/   {UOP_UP,1}, 
/*0x07*/   {UOP_ENTER,0}, 
/*0x08*/   {UOP_AUDIO,0},     //BACK MUSIC 
/*0x09*/   {UOP_PHOTO,0},       // UOP_0
/*0x0A*/   {UOP_END_PAUSE,0}, 
/*0x0B*/   {UOP_NOP,0}, 
/*0x0C*/   {UOP_NOP,0}, 
/*0x0D*/   {UOP_TXT,0}, //UOP_FAST_FORWARD
/*0x0E*/   {UOP_PREVIOUS_CHAP,0}, 
/*0x0F*/   {UOP_NOP,0}, 
/*0x10*/   {UOP_NOP,0}, 
/*0x11*/   {UOP_ZOOM,0}, 
/*0x12*/   {UOP_HOME,0}, 
/*0x13*/   {UOP_PHOTO,0},       //UOP_0
/*0x14*/   {UOP_POWER,0}, 
/*0x15*/   {UOP_FAST_BACKWARD,0}, 
/*0x16*/   {UOP_NOP,0}, 
/*0x17*/   {UOP_OSD,0}, 
/*0x18*/   {UOP_RESUME,0}, 
/*0x19*/   {UOP_169_43,0}, 
/*0x1A*/   {UOP_NEXT_CHAP,0}, 
/*0x1B*/   {UOP_ANGLE,0}, 
/*0x1C*/   {UOP_RIGHT,0}, 
/*0x1D*/   {UOP_MUSIC,0},   //UOP_7
/*0x1E*/   {UOP_STOP,0}, 
/*0x1F*/   {UOP_MOVIE,0},   //UOP_9
/*0x20*/   {UOP_NOP,0}, 
/*0x21*/   {UOP_NOP,0}, 
/*0x22*/   {UOP_NOP,0}, 
/*0x23*/   {UOP_NOP,0}, 
/*0x24*/   {UOP_NOP,0}, 
/*0x25*/   {UOP_NOP,0}, 
/*0x26*/   {UOP_NOP,0}, 
/*0x27*/   {UOP_NOP,0}, 
/*0x28*/   {UOP_NOP,0}, 
/*0x29*/   {UOP_NOP,0}, 
/*0x2A*/   {UOP_NOP,0},
/*0x2B*/   {UOP_NOP,0},
/*0x2C*/   {UOP_NOP,0},
/*0x2D*/   {UOP_NOP,0},
/*0x2E*/   {UOP_NOP,0},
/*0x2F*/   {UOP_NOP,0},
/*0x30*/   {UOP_NOP,0},
/*0x31*/   {UOP_NOP,0},
/*0x32*/   {UOP_NOP,0},
/*0x33*/   {UOP_NOP,0},
/*0x34*/   {UOP_NOP,0},
/*0x35*/   {UOP_NOP,0},
/*0x36*/   {UOP_NOP,0},
/*0x37*/   {UOP_NOP,0},
/*0x38*/   {UOP_NOP,0},
/*0x39*/   {UOP_NOP,0},
/*0x3A*/   {UOP_NOP,0},
/*0x3B*/   {UOP_NOP,0},
/*0x3C*/   {UOP_NOP,0},
/*0x3D*/   {UOP_NOP,0},
/*0x3E*/   {UOP_NOP,0},
/*0x3F*/   {UOP_NOP,0},
/*0x40*/   {UOP_RIGHT,0}, 
/*0x41*/   {UOP_NOP,0}, 
/*0x42*/   {UOP_NOP,0}, 
/*0x43*/   {UOP_NOP,0}, 
/*0x44*/   {UOP_DOWN,1}, 
/*0x45*/   {UOP_NOP,0}, 
/*0x46*/   {UOP_MUTE,0}, 
/*0x47*/   {UOP_LEFT,0}, 
/*0x48*/   {UOP_SETUP,0},        //NETMENUSETUP
/*0x49*/   {UOP_NOP,0}, 
/*0x4A*/   {UOP_NOP,0}, 
/*0x4B*/   {UOP_NOP,0}, 
/*0x4C*/   {UOP_NOP,0}, 
/*0x4D*/   {UOP_NOP,0}, 
/*0x4E*/   {UOP_NOP,0}, 
/*0x4F*/   {UOP_NOP,0}, 
/*0x50*/   {UOP_SLIDE_SHOW,0},  // UOP_6
/*0x51*/   {UOP_VOL_MINUS,1},   // UOP_PAUSE
/*0x52*/   {UOP_NOP,0}, 
/*0x53*/   {UOP_NOP,0}, 
/*0x54*/   {UOP_NOP,0}, 
/*0x55*/   {UOP_NOP,0},
/*0x56*/   {UOP_NOP,0},
/*0x57*/   {UOP_NOP,0},
/*0x58*/   {UOP_NOP,0},
/*0x59*/   {UOP_NOP,0},
/*0x5A*/   {UOP_NOP,0},
/*0x5B*/   {UOP_NOP,0},
/*0x5C*/   {UOP_NOP,0},
/*0x5D*/   {UOP_NOP,0},
/*0x5E*/   {UOP_NOP,0},
/*0x5F*/   {UOP_NOP,0},
/*0x60*/   {UOP_NOP,0},
/*0x61*/   {UOP_NOP,0},
/*0x62*/   {UOP_NOP,0},
/*0x63*/   {UOP_NOP,0},
/*0x64*/   {UOP_NOP,0},
/*0x65*/   {UOP_NOP,0},
/*0x66*/   {UOP_NOP,0},
/*0x67*/   {UOP_NOP,0},
/*0x68*/   {UOP_NOP,0},
/*0x69*/   {UOP_NOP,0},
/*0x6A*/   {UOP_NOP,0},
/*0x6B*/   {UOP_NOP,0},
/*0x6C*/   {UOP_NOP,0},
/*0x6D*/   {UOP_NOP,0},
/*0x6E*/   {UOP_NOP,0},
/*0x6F*/   {UOP_NOP,0},
/*0x70*/   {UOP_NOP,0},
/*0x71*/   {UOP_NOP,0},
/*0x72*/   {UOP_NOP,0},
/*0x73*/   {UOP_NOP,0},
/*0x74*/   {UOP_NOP,0},
/*0x75*/   {UOP_NOP,0},
/*0x76*/   {UOP_NOP,0},
/*0x77*/   {UOP_NOP,0},
/*0x78*/   {UOP_NOP,0},
/*0x79*/   {UOP_NOP,0},
/*0x7A*/   {UOP_NOP,0},
/*0x7B*/   {UOP_NOP,0},
/*0x7C*/   {UOP_NOP,0},
/*0x7D*/   {UOP_NOP,0},
/*0x7E*/   {UOP_NOP,0},
/*0x7F*/   {UOP_NOP,0},
/*0x80*/   {UOP_NOP,0},
/*0x81*/   {UOP_NOP,0},
/*0x82*/   {UOP_NOP,0},
/*0x83*/   {UOP_NOP,0},
/*0x84*/   {UOP_NOP,0},
/*0x85*/   {UOP_NOP,0},
/*0x86*/   {UOP_NOP,0},
/*0x87*/   {UOP_NOP,0},
/*0x88*/   {UOP_NOP,0},
/*0x89*/   {UOP_NOP,0},
/*0x8A*/   {UOP_NOP,0},
/*0x8B*/   {UOP_NOP,0},
/*0x8C*/   {UOP_NOP,0},
/*0x8D*/   {UOP_NOP,0},
/*0x8E*/   {UOP_NOP,0},
/*0x8F*/   {UOP_NOP,0},
/*0x90*/   {UOP_NOP,0},
/*0x91*/   {UOP_NOP,0},
/*0x92*/   {UOP_NOP,0},
/*0x93*/   {UOP_NOP,0},
/*0x94*/   {UOP_NOP,0},
/*0x95*/   {UOP_NOP,0},
/*0x96*/   {UOP_NOP,0},
/*0x97*/   {UOP_NOP,0},
/*0x98*/   {UOP_NOP,0},
/*0x99*/   {UOP_NOP,0},
/*0x9A*/   {UOP_NOP,0},
/*0x9B*/   {UOP_NOP,0},
/*0x9C*/   {UOP_NOP,0},
/*0x9D*/   {UOP_NOP,0},
/*0x9E*/   {UOP_NOP,0},
/*0x9F*/   {UOP_NOP,0},
/*0xA0*/   {UOP_NOP,0},
/*0xA1*/   {UOP_NOP,0},
/*0xA2*/   {UOP_NOP,0},
/*0xA3*/   {UOP_NOP,0},
/*0xA4*/   {UOP_NOP,0},
/*0xA5*/   {UOP_NOP,0},
/*0xA6*/   {UOP_NOP,0},
/*0xA7*/   {UOP_NOP,0},
/*0xA8*/   {UOP_NOP,0},
/*0xA9*/   {UOP_NOP,0},
/*0xAA*/   {UOP_NOP,0},
/*0xAB*/   {UOP_NOP,0},
/*0xAC*/   {UOP_NOP,0},
/*0xAD*/   {UOP_NOP,0},
/*0xAE*/   {UOP_NOP,0},
/*0xAF*/   {UOP_NOP,0},
/*0xB0*/   {UOP_NOP,0},
/*0xB1*/   {UOP_NOP,0},
/*0xB2*/   {UOP_NOP,0},
/*0xB3*/   {UOP_NOP,0},
/*0xB4*/   {UOP_NOP,0},
/*0xB5*/   {UOP_NOP,0},
/*0xB6*/   {UOP_NOP,0},
/*0xB7*/   {UOP_NOP,0},
/*0xB8*/   {UOP_NOP,0},
/*0xB9*/   {UOP_NOP,0},
/*0xBA*/   {UOP_NOP,0},
/*0xBB*/   {UOP_NOP,0},
/*0xBC*/   {UOP_NOP,0},
/*0xBD*/   {UOP_NOP,0},
/*0xBE*/   {UOP_NOP,0},
/*0xBF*/   {UOP_NOP,0},
/*0xC0*/   {UOP_NOP,0},
/*0xC1*/   {UOP_NOP,0},
/*0xC2*/   {UOP_NOP,0},
/*0xC3*/   {UOP_NOP,0},
/*0xC4*/   {UOP_NOP,0},
/*0xC5*/   {UOP_NOP,0},
/*0xC6*/   {UOP_NOP,0},
/*0xC7*/   {UOP_NOP,0},
/*0xC8*/   {UOP_NOP,0},
/*0xC9*/   {UOP_NOP,0},
/*0xCA*/   {UOP_NOP,0},
/*0xCB*/   {UOP_NOP,0},
/*0xCC*/   {UOP_NOP,0},
/*0xCD*/   {UOP_NOP,0},
/*0xCE*/   {UOP_NOP,0},
/*0xCF*/   {UOP_NOP,0},
/*0xD0*/   {UOP_NOP,0},
/*0xD1*/   {UOP_NOP,0},
/*0xD2*/   {UOP_NOP,0},
/*0xD3*/   {UOP_NOP,0},
/*0xD4*/   {UOP_NOP,0},
/*0xD5*/   {UOP_NOP,0},
/*0xD6*/   {UOP_NOP,0},
/*0xD7*/   {UOP_NOP,0},
/*0xD8*/   {UOP_NOP,0},
/*0xD9*/   {UOP_NOP,0},
/*0xDA*/   {UOP_NOP,0},
/*0xDB*/   {UOP_NOP,0},
/*0xDC*/   {UOP_NOP,0},
/*0xDD*/   {UOP_NOP,0},
/*0xDE*/   {UOP_NOP,0},
/*0xDF*/   {UOP_NOP,0},
/*0xE0*/   {UOP_NOP,0},
/*0xE1*/   {UOP_NOP,0},
/*0xE2*/   {UOP_NOP,0},
/*0xE3*/   {UOP_NOP,0},
/*0xE4*/   {UOP_NOP,0},
/*0xE5*/   {UOP_NOP,0},
/*0xE6*/   {UOP_NOP,0},
/*0xE7*/   {UOP_NOP,0},
/*0xE8*/   {UOP_NOP,0},
/*0xE9*/   {UOP_NOP,0},
/*0xEA*/   {UOP_NOP,0},
/*0xEB*/   {UOP_NOP,0},
/*0xEC*/   {UOP_NOP,0},
/*0xED*/   {UOP_NOP,0},
/*0xEE*/   {UOP_NOP,0},
/*0xEF*/   {UOP_NOP,0},
/*0xF0*/   {UOP_NOP,0},
/*0xF1*/   {UOP_NOP,0},
/*0xF2*/   {UOP_NOP,0},
/*0xF3*/   {UOP_NOP,0},
/*0xF4*/   {UOP_NOP,0},
/*0xF5*/   {UOP_NOP,0},
/*0xF6*/   {UOP_NOP,0},
/*0xF7*/   {UOP_NOP,0},
/*0xF8*/   {UOP_NOP,0},
/*0xF9*/   {UOP_NOP,0},
/*0xFA*/   {UOP_NOP,0},
/*0xFB*/   {UOP_NOP,0},
/*0xFC*/   {UOP_NOP,0},
/*0xFD*/   {UOP_NOP,0},
/*0xFE*/   {UOP_NOP,0},
};


#endif

extern void SetTVOutPutModePara(INT8U OutPutmode);

extern int aw_title_mode;
extern INT32U NODIR_FLAG;
extern INT8U isMute ;
extern INT8U CurrentOsdSize;
extern char TV_Mode_Switch_Flag;
extern char upgrade_stopkey_flag;
unsigned char user_power_flag;
extern _SETUP_MENU_ Setup_Menu[];
static INT32U current_time = 0;
static INT32U last_time = 0;

#ifdef SUPPORT_STANDBY
char iPowerFlag=0;
#endif


INT32S AWNecRemoteKeyTranslation(INPUTDATA *pInputData)
{
	INT8U my_app_id;
	static INT32U timecount=0;
	INT32U ir_value_custom;
	
	if((pInputData->input_flag & INPUT_VALID)&&(pInputData->input_type == KEY_DOWN)&&(!upgrade_stopkey_flag)){
		INT32U ir_value = pInputData->input_data ;
		current_time = AVTimeGet();
		if ((current_time - last_time) < 200){
			pInputData->input_data = UOP_NOP;
		//	last_time = current_time;
			return 0;
		}
		last_time = current_time;
		
		//check customer key at here
		ir_value_custom = ir_value&0xffff;
		if(ir_value_custom!=CUSTOM_CODE)
			return;
				
		{
		#ifdef WANLIDA_REMOTE
			ir_value = (ir_value)&0xff ;
		#else		    
		    ir_value = (ir_value>>16)&0xff ;
		#endif
			if(pInputData->input_flag & INPUT_REPEAT_FLAG){
			if(NecIrKey[ir_value].IrFlag){
				#ifdef MALATA_VERSION									// back to 480iCVBS after press setup key longtime for malata only
					if(NecIrKey[ir_value].IrKey == UOP_SETUP){
						timecount++;
						if(timecount>=8)
							pInputData->input_data = NecIrKey[ir_value].IrKey ;
						else
							pInputData->input_data = UOP_NOP ;
						
					}
					else
						pInputData->input_data = NecIrKey[ir_value].IrKey ;
				#else	
					pInputData->input_data = NecIrKey[ir_value].IrKey ;
				#endif
			}
			else
				pInputData->input_data = UOP_NOP ;
			}
			else {
		#ifdef MALATA_VERSION
				if(NecIrKey[ir_value].IrKey != UOP_SETUP)
		#endif
					pInputData->input_data = NecIrKey[ir_value].IrKey ;
				timecount = 0;
			}	
			if(user_power_flag&&pInputData->input_data!=UOP_POWER)
				return;
			if(pInputData->input_data == UOP_3)
				pInputData->input_data = UOP_HOME; 

			if(pInputData->input_data == UOP_8)
				pInputData->input_data = UOP_NOP; 			
			
			if(NoVolumeControlWin() == 1){
				if(pInputData->input_data == UOP_MUTE){
					pInputData->input_data = UOP_NOP;
					return 0;
				}
				else if((pInputData->input_data == UOP_VOL_PLUS)){
					pInputData->input_data = UOP_NOP;
					return 0;					
				}
				else if(pInputData->input_data == UOP_VOL_MINUS){
					pInputData->input_data = UOP_NOP;
					return 0;					
				}
			}
			
			if((pInputData->input_data == UOP_MUTE)&&(IsWingpFocusWin() == 0)){
				if(GPIO_MUTE_STATUS){
					isMute = UNMUTE;
					GPIO_MB_UNMUTE;
				}
				else{
					isMute = MUTE;
					GPIO_MB_MUTE;
				}
			}
		#ifndef KOREAR_REMOTE
			if((pInputData->input_data == UOP_VOL_MINUS)||(pInputData->input_data == UOP_VOL_PLUS)){
				if((IsWingpFocusWin() == 0)&&(CheckMediaPlaybackApp() == 1)){
					if(pInputData->input_data == UOP_VOL_MINUS){
						ProcessVolume_Common(1) ; // Vol -
					}
					else if(pInputData->input_data == UOP_VOL_PLUS)
						ProcessVolume_Common(0) ; // Vol +
						
				}
			}
		#endif

			AWGetAppID(MEDIA_GENERAL, &my_app_id) ; 
			if ((NODIR_FLAG == 1) && (AWGetAppStatus(my_app_id) == APP_RUNNING)){
				if (pInputData->input_data == UOP_NEXT_CHAP)	
				#ifdef WISTAR_VERSION//modified by Hexiang for bug 23261 20071101
					pInputData->input_data = UOP_DOWN;
				#else
					pInputData->input_data = UOP_NOP;
				#endif
				else if (pInputData->input_data == UOP_PREVIOUS_CHAP)	
				#ifdef WISTAR_VERSION
					pInputData->input_data = UOP_UP;
				#else
					pInputData->input_data = UOP_NOP;
				#endif				
			}
		#ifndef SURPORT_TVM
			if(AWGetTopWindow(gpFocusWin) == AWFindWinCtrlByName(WinDeviceSelect)){
				if (pInputData->input_data == UOP_NTSC_PAL){
				#ifdef WISTAR_VERSION
				switch(CurrentOsdSize)
           			 {
					#ifdef TV_MODE_1080P
		                case OsdSize1080p:
		        	        CurrentOsdSize = OsdSize480p;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id = 0;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id_saved= 0;
		    				SetTVOutPutModePara(0);
		        	        break;
                    #endif
					#ifdef TV_MODE_720P
		                case OsdSize720p:
		        	        CurrentOsdSize = OsdSize480p;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id = 0;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id_saved= 0;
		    				SetTVOutPutModePara(0);
		        	        break;
					#endif
		                case OsdSize480p:
		        	        CurrentOsdSize = OsdSize576p;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id = 1;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id_saved= 1;
		    				SetTVOutPutModePara(1);
		        	        break;
		                case OsdSize576p:
		        	        CurrentOsdSize = OsdSize480iCVBS;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id = 2;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id_saved= 2;
		    				SetTVOutPutModePara(2);
		        	        break;
		                case OsdSize480iCVBS:
		        	        CurrentOsdSize = OsdSize576iCVBS;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id = 3;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id_saved= 3;
		    				SetTVOutPutModePara(3);
		        	        break;
		                case OsdSize576iCVBS:
		                default:
		        	        CurrentOsdSize = OsdSize720p;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id = 4;
		    				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id_saved= 4;
		    				SetTVOutPutModePara(4);
        	       			 break;
           			 }
					#else
					CurrentOsdSize++;
					#ifdef defined (TV_MODE_720P)||defined (TV_MODE_1080P)
						if(CurrentOsdSize == 9) 
					#else
						if(CurrentOsdSize == 8)
					#endif
						CurrentOsdSize = 3;
					TV_Mode_Switch_Flag	= 1;
					Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id = CurrentOsdSize - 3;
					Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id_saved= CurrentOsdSize - 3 ;
					SetTVOutPutModePara(CurrentOsdSize - 3);
					#endif
					ChangeOutputMode();
					SetTVOutput();
					GUIShowWindow(WinDeviceSelect);
				}
			}
			if(AWGetTopWindow(gpFocusWin) == AWFindWinCtrlByName(WinDeviceSelect)
				||AWGetTopWindow(gpFocusWin) == AWFindWinCtrlByName(WinSetup_net_menu)){
				if((pInputData->input_data == UOP_SETUP)&&(CurrentOsdSize!=7)&&(timecount!=0)){ //timecount !=0  only malata setup key have this function
					 timecount=0;
					CurrentOsdSize = 7;
					TV_Mode_Switch_Flag	= 1;
				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id = CurrentOsdSize - 3;
				Setup_Menu[TV_SYSTEM_ITEM_ID].Option_id_saved = CurrentOsdSize - 3;
				SetTVOutPutModePara( CurrentOsdSize - 3);
					ChangeOutputMode();
					SetTVOutput();
					GUIShowWindow(WinDeviceSelect);
					
			}
			}	
		#endif
#ifdef SUPPORT_STANDBY
	         if(pInputData->input_data == UOP_POWER){
			    pInputData->input_data = UOP_NOP;
			    if(iPowerFlag){
					iPowerFlag = 0;
					WRITE_MPEG_REG_ISA(VENC_VDAC_SETTING,0);
					chip_power_on(1);
					_disable();
					while(1);
					//READ_PERI_REG(0xb4);
					READ_MPEG_REG_ISA(0x12000b4);
			    }
			    else{			    
					iPowerFlag = 1;
					//ReloadLogo();
					CloseMediaPlaybackApp(0);
					if(CheckMediaPlaybackVideoApp()){
						user_power_flag = 1;	
					}else{
//						user_power_flag = 0;
						disable_video_layer();
#ifndef AML_NIKE						
						set_chip_clocks(CHIP_CLOCK_0360);
#else
						set_chip_clocks(CHIP_CLOCK_0480);
#endif						
						chip_power_on(0);
						READ_MPEG_REG_ISA(0x12000b4);
						WRITE_MPEG_REG_ISA(VENC_VDAC_SETTING,0xfff);
						
					}
			    }
			}
#endif					 
		}
	}
	return 0 ;
}

void RegisterNecRemoteDev()
{
	INT32U remote_para ;
	INT32S iRemoteDevHandle = -1 ; //not open or open fail

#ifdef SOFTWARE_MODE_REMOTE
	iRemoteDevHandle = open("/dev/nec_software_mode_remote", O_RDONLY) ;
	ASSERT((iRemoteDevHandle == -1),"RegisterNecSoftwareModeRemoteDev : Open /dev/nec_software_mode_remote Faile...");
#else
	iRemoteDevHandle = open("/dev/nec_remote", O_RDONLY) ;
	ASSERT((iRemoteDevHandle == -1),"RegisterNecRemoteDev : Open /dev/nec_remote Faile...");
//	remote_para = 0x00000096;
//	ioctl(iRemoteDevHandle, IOCMD_NEC_SET_REMOTE_CLOCK, &remote_para) ;
	remote_para = 0x00000000;
	ioctl(iRemoteDevHandle, IOCMD_NEC_SET_FRAME_MASK, &remote_para) ;
//	ioctl(iRemoteDevHandle, IOCMD_NEC_HOLD_FIRST_KEY, 0) ;
#endif
	AWRegisterInputDev(iRemoteDevHandle, AWNecRemoteKeyTranslation) ;

    return;
}


#ifdef SUPPORT_KEYBOARD
//{3,2,5,4,6,7}
static const INPUTKETMAP KeyboardUOP[]={
	{UOP_NOP,0},
	{UOP_NOP,0},
	{UOP_UP,0},
	{UOP_ENTER,0},
	{UOP_LEFT,0},
	{UOP_DOWN,0},
	{UOP_RIGHT,0},
	{UOP_RESUME,0}    //UOP_STOP
};

static INT32S AWKeyboardTranslation(INPUTDATA *pInputData)
{ 
	 PHWND hwnd = AWGetTopWindow(gpFocusWin) ;
	if((pInputData->input_flag & INPUT_VALID)&&(pInputData->input_type == KEY_DOWN)){
	    
        pInputData->input_data = KeyboardUOP[pInputData->input_data].IrKey ;		
	}
	return 0;
}
static void RegisterKeyboardDev()
{
//	INT32U remote_para;
	INT32S iKeyboardDevHandle = -1 ; //not open or open fail

	iKeyboardDevHandle = open("/dev/keyboard", O_RDONLY) ;
	ASSERT((iKeyboardDevHandle == -1),"RegisterKeyboardDev : Open /dev/keyboard Faile...");
	AWRegisterInputDev(iKeyboardDevHandle, AWKeyboardTranslation) ;

    return;
}

#define KEY_DELAY 6
extern int  GetKey(void);
static INT32S GetKeyValue(void)
{
	int keyvaluetemp=0;
	static int keynumber=0;
	static unsigned short timeout=0;
	
	if(keynumber !=0){
		timeout++;
		if(timeout>KEY_DELAY){	
			timeout=0;
			keynumber=0;
		}	
		else
			return 0;
	}
	keyvaluetemp=GetKey();

    keynumber=keyvaluetemp;
	timeout=0;
	if(keynumber<8)
		return keynumber;
	else
		return 0;			
}
#endif

void RegisterAllInputDev()
{
    RegisterNecRemoteDev();
#ifdef SUPPORT_KEYBOARD
    AWRegisterKeyboardIRQ(GetKeyValue);
    RegisterKeyboardDev();
#endif
    return;
}


